package com.example.design.mediator;

/**
 * @author hej
 * @date 2022/11/4 17:33
 */
public class Client {
    public static void main(String[] args) {
        /**
         * 这个例子不好，说是解耦，实际上用另一种方式增加了耦合度，需要换
         */
        Mediator mediator = new ConcreteMediator();
        Alarm alarm = new Alarm(mediator, "alarm");
        CoffeeMachine coffeeMachine = new CoffeeMachine(mediator, "coffeeMachine");
        Curtains curtain = new Curtains(mediator, "curtain");
        TV tv = new TV(mediator, "tv");
        // 闹钟发出声响
        alarm.sendAlarm(0);
        coffeeMachine.stopCoffee();
        //alarm.sendAlarm(1);
    }
}
